<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var stus = [{
            id:101,
            name:'zhangsan',
            gender:'男'
        },{
            id:102,
            name:'zhangsi',
            gender:'男'
        },{
            id:103,
            name:'zhangwu',
            gender:'女'
        },{
            id:104,
            name:'zhangliu',
            gender:'女'
        },{
            id:105,
            name:'zhangqi',
            gender:'男'
        }];
        // 数组迭代方法
        stus.forEach(function(item,index){
            console.log(item,index);
        })
        // 是否都满足  true/false
        var result = stus.every(function(item,index){
            return item.gender == '男';
        })
        console.log(result);
        // 判断是否有一个满足  true/false
        var result = stus.some(function(item,index){
            return item.gender == '男';
        })
        console.log(result);
        // map 映射
        // 从学生信息中抽学生姓名，组成数组
        // 从学生数组中，一个元素生成一个tr
        var result = stus.map(function(item,index){
            return item.name;
        })
        console.log(result);
        // 过滤
        var result = stus.filter(function(item,index){
            return item.gender == '女';
        })
        console.log(result);
    </script>
</body>
</html>